package com.bianmaba.activiti.beans.entity.activiti;

import com.bianmaba.spring.data.jpa.domain.annotations.QueryCacheable;
import com.bianmaba.spring.data.jpa.domain.entity.BaseEntity;
import lombok.Data;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import java.util.Date;

/**
 * @program: example-spring-boot-extend
 * @description:
 * @author: Chenjiabin
 * @create: 2019/9/2 9:59
 **/
@DynamicUpdate(true)
@DynamicInsert(true)
@Entity
//此注解重新定义为是否开启查询缓存
@QueryCacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Data
public class Audit extends BaseEntity {
    private String processInstanceId;
    private String taskId;
    private String userId;
    private String userName;
    //0:不通过 1:不通过
    private Integer result;
    //0:申请 1:审批中  2:已完成
    private String comment;

    //审批日期
    public Date getTime() {
        return new Date(this.cdt);
    }
}